Calendar All Tests
Current file: /home/estudydev/workspace/eStudy_svn/web/user/classes/dataretriever/class.userdataretriever.inc.php
Legend: executed not executed dead code

  Coverage
  Classes Methods Lines
Total
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 3
0.00 %0.00%
0.00% 0 / 109
 
UserDataRetriever
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 3
0.00 %0.00%
0.00% 0 / 109
 public function __construct($id)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 2
 public function retrieve()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 72
 private function getSQLQuery()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 35


       1                 : <?php                                                                                                                     
       2                 : /*--------------------------------------------------------------------------+                                             
       3                 : This file is part of eStudy.                                                                                              
       4                 : user/classes/dataretriever/class.userdataretriever.inc.php                                                                
       5                 : - Modulgruppe:  Benutzerverwaltung                                                                                        
       6                 : - Beschreibung: Diese Klasse enthaelt alle wichtigen Methoden, die zur Beschaffung von Benutzerdaten dienen               
       7                 : - Version:      0.01, 22/01/08                                                                                            
       8                 : - Autor(en):    Ali-Riza Ciftcioglu <Ali-Riza.Ciftcioglu@mni.fh-giessen.de>                                               
       9                 :                                                                                                                           
      10                 : +---------------------------------------------------------------------------+                                             
      11                 : This program is free software; you can redistribute it and/or                                                             
      12                 : modify it under the terms of the GNU General Public License                                                               
      13                 : as published by the Free Software Foundation; either version 2                                                            
      14                 : of the License, or any later version.                                                                                     
      15                 : +---------------------------------------------------------------------------+                                             
      16                 : This program is distributed in the hope that it will be useful,                                                           
      17                 : but WITHOUT ANY WARRANTY; without even the implied warranty of                                                            
      18                 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                                             
      19                 : GNU General Public License for more details.                                                                              
      20                 : You should have received a copy of the GNU General Public License                                                         
      21                 : along with this program; if not, write to the Free Software                                                               
      22                 : Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                                               
      23                 : +--------------------------------------------------------------------------*/                                             
      24                 : /**                                                                                                                       
      25                 :  * In dieser Datei wird das INterface GenericDataRetriever implementiert                                                  
      26                 :  * @package eStudy.User                                                                                                   
      27                 :  * @author     Ali-Riza Ciftcioglu <Ali-Riza.Ciftcioglu@mni.fh-giessen.de>                                                
      28                 :  * @version 0.01, 22/01/08                                                                                                
      29                 :  */                                                                                                                       
      30                 :                                                                                                                           
      31                 :                                                                                                                           
      32                 :                                                                                                                           
      33                 : /** Einbinden des Interfaces*/                                                                                            
      34                 : require_once (PATH_TO_ROOT.'user/classes/dataretriever/interface.genericdataretriever.inc.php');                          
      35                 :                                                                                                                           
      36                 : class UserDataRetriever                                                                                                   
      37                 :      implements GenericDataRetriever {                                                                                    
      38                 :                                                                                                                           
      39                 :     private $userid;                                                                                                      
      40                 :                                                                                                                           
      41                 :     private $userdata =array();                                                                                           
      42                 :                                                                                                                           
      43                 :                                                                                                                           
      44                 :                                                                                                                           
      45                 :     /**                                                                                                                   
      46                 :      * Constructor for class UserDataRetriever. This class helps to get the necessary userdata for different applications.
      47                 :      *                                                                                                                    
      48                 :      * @param int $id: the user ID                                                                                        
      49                 :      */                                                                                                                   
      50                 :     public function __construct($id){                                                                                     
      51               0 :          if(is_numeric($id)) $this->userid=$id;                                                                           
      52               0 :     }                                                                                                                     
      53                 :                                                                                                                           
      54                 :                                                                                                                           
      55                 :                                                                                                                           
      56                 :     /**                                                                                                                   
      57                 :      *                                                                                                                    
      58                 :      * @see GenericDataRetriever::Retrieve()                                                                              
      59                 :       */                                                                                                                  
      60                 :     public function retrieve() {                                                                                          
      61               0 :         global $db, $EZSQL_ERROR;                                                                                         
      62                 :                                                                                                                           
      63               0 :         $querystring=UserDataRetriever::getSQLQuery();                                                                    
      64                 :                                                                                                                           
      65                 :                                                                                                                           
      66               0 :         $data = $db->get_row($querystring);                                                                               
      67                 :         //Benutzerdaten pruefen                                                                                           
      68               0 :         if ($db->num_rows && $data->ID == $this->userid) {                                                                
      69               0 :             $this->userdata['userID'] = $data->ID;                                                                        
      70               0 :             $this->userdata['vorname'] = $data->vorname;                                                                  
      71               0 :             $this->userdata['nachname'] = $data->nachname;                                                                
      72               0 :             $this->userdata['loginname'] = $data->loginname;                                                              
      73               0 :             $this->userdata['shortname'] = $data->shortname;                                                              
      74               0 :             $this->userdata['password'] = $data->password;                                                                
      75               0 :             $this->userdata['usergroup'] = $data->usergroup;                                                              
      76               0 :             $this->userdata['oldUsergroup'] = $data->usergroup;                                                           
      77               0 :             $this->userdata['email'] = $data->email;                                                                      
      78               0 :             if (empty($data->lastUpdate) || $data->lastUpdate == "0000-00-00 00:00:00") {                                 
      79               0 :                 $this->userdata['lastUpdate'] = $data->regdate;                                                           
      80               0 :             } else {                                                                                                      
      81               0 :                 $this->userdata['lastUpdate'] = $data->lastUpdate;                                                        
      82                 :             }                                                                                                             
      83               0 :             $this->userdata['invisible'] = $data->invisible;                                                              
      84               0 :             $this->userdata['salutation'] = $data->salutation;                                                            
      85               0 :             $this->userdata['street'] = $data->street;                                                                    
      86               0 :             $this->userdata['postcode'] = $data->postcode;                                                                
      87               0 :             $this->userdata['location'] = $data->location;                                                                
      88               0 :             $this->userdata['countryID'] = $data->countryID;                                                              
      89               0 :             $this->userdata['gender'] = $data->gender;                                                                    
      90               0 :             $this->userdata['picture'] = $data->picture;                                                                  
      91               0 :             $this->userdata['picTitle'] = $data->pictitle;                                                                
      92               0 :             $this->userdata['regdate'] = $data->regdate;                                                                  
      93               0 :             $this->userdata['adrShowFlag'] = $data->adrShowFlag;                                                          
      94               0 :             $this->userdata['picShowFlag'] = $data->picShowFlag;                                                          
      95               0 :             $this->userdata['mailShowFlag'] = $data->mailShowFlag;                                                        
      96               0 :             $this->userdata['university'] = $data->university;                                                            
      97               0 :             $this->userdata['department'] = $data->department;                                                            
      98               0 :             $this->userdata['subject'] = $data->subject;                                                                  
      99               0 :             $this->userdata['hpCounter'] = $data->hpcounter;                                                              
     100               0 :             $this->userdata['contextKeywords'] = $data->contextKeywords;                                                  
     101               0 :             $this->userdata['contextNews'] = $data->contextNews;                                                          
     102               0 :             $this->userdata['styleOverwriteMode'] = $data->styleOverwriteMode;                                            
     103               0 :             $this->userdata['numFailedLogins'] = $data->numFailedLogins;                                                  
     104               0 :             $this->userdata['numBansForFailedLogin'] = $data->numBansForFailedLogin;                                      
     105               0 :             $this->userdata['styleTemplate'] = $data->styleTemplate;                                                      
     106               0 :             $_SESSION['contextUserKeywords'] = $data->contextKeywords;                                                    
     107               0 :             $_SESSION['contextUserNews'] = $data->contextNews;                                                            
     108                 :             /* 'styleOverwriteMode' in Session setzen, wird von 'common/class.auth.inc.php' verwendet */                  
     109               0 :             $_SESSION['styleOverwriteMode'] = $data->styleOverwriteMode;                                                  
     110               0 :             return $this->userdata;                                                                                       
     111                 :         } else {                                                                                                          
     112               0 :             $this->userdata['userID'] = $this->userid;                                                                    
     113               0 :             $this->userdata['vorname'] = "";                                                                              
     114               0 :             $this->userdata['nachname'] = "";                                                                             
     115               0 :             $this->userdata['loginname'] = "";                                                                            
     116               0 :             $this->userdata['shortname'] = "NULL";                                                                        
     117               0 :             $this->userdata['password'] = "";                                                                             
     118               0 :             $this->userdata['usergroup'] = 0;                                                                             
     119               0 :             $this->userdata['oldUsergroup'] = 0;                                                                          
     120               0 :             $this->userdata['email'] = "";                                                                                
     121               0 :             $this->userdata['lastUpdate'] = "";                                                                           
     122               0 :             $this->userdata['invisible'] = 0;                                                                             
     123               0 :             $this->userdata['salutation'] = 0;                                                                            
     124               0 :             $this->userdata['street'] = "NULL";                                                                           
     125               0 :             $this->userdata['postcode'] = "NULL";                                                                         
     126               0 :             $this->userdata['location'] = "NULL";                                                                         
     127               0 :             $this->userdata['countryID'] = 0;                                                                             
     128               0 :             $this->userdata['gender'] = 0;                                                                                
     129               0 :             $this->userdata['picture'] = "NULL";                                                                          
     130               0 :             $this->userdata['picTitle'] = "NULL";                                                                         
     131               0 :             $this->userdata['regdate'] = "";                                                                              
     132               0 :             $this->userdata['adrShowFlag'] = 0;                                                                           
     133               0 :             $this->userdata['picShowFlag'] = 1;                                                                           
     134               0 :             $this->userdata['mailShowFlag'] = 0;                                                                          
     135               0 :             $this->userdata['university'] = "NULL";                                                                       
     136               0 :             $this->userdata['department'] = "NULL";                                                                       
     137               0 :             $this->userdata['subject'] = "NULL";                                                                          
     138               0 :             $this->userdata['hpCounter'] = 1;                                                                             
     139               0 :             return $this->userdata;                                                                                       
     140                 :         }                                                                                                                 
     141                 :                                                                                                                           
     142                 :     }                                                                                                                     
     143                 :                                                                                                                           
     144                 :     /**                                                                                                                   
     145                 :      * This function builds an sql query and returns it.                                                                  
     146                 :      * The query is built in order to fetch the user data.                                                                
     147                 :      *                                                                                                                    
     148                 :      * @return String                                                                                                     
     149                 :      */                                                                                                                   
     150                 :     private function getSQLQuery(){                                                                                       
     151               0 :         $select = "SELECT user.ID as ID, ";                                                                               
     152               0 :         $select.= "user.Nachname as nachname, ";                                                                          
     153               0 :         $select.= "user.Vorname as vorname, ";                                                                            
     154               0 :         $select.= "user.Email AS email, ";                                                                                
     155               0 :         $select.= "user.ShortName AS shortname, ";                                                                        
     156               0 :         $select.= "user.Login AS loginname, ";                                                                            
     157               0 :         $select.= "user.Password AS password, ";                                                                          
     158               0 :         $select.= "user.Usergroup AS usergroup, ";                                                                        
     159               0 :         $select.= "user.lastupdate AS lastUpdate, ";                                                                      
     160               0 :         $select.= "user.invisible AS invisible, ";                                                                        
     161               0 :         $select.= "user.salutation AS salutation, ";                                                                      
     162               0 :         $select.= "user.street AS street, ";                                                                              
     163               0 :         $select.= "user.postcode AS postcode, ";                                                                          
     164               0 :         $select.= "user.location AS location, ";                                                                          
     165               0 :         $select.= "user.countryID AS countryID, ";                                                                        
     166               0 :         $select.= "user.gender AS gender, ";                                                                              
     167               0 :         $select.= "user.picture AS picture, ";                                                                            
     168               0 :         $select.= "user.pictitle AS pictitle, ";                                                                          
     169               0 :         $select.= "user.regdate AS regdate, ";                                                                            
     170               0 :         $select.= "user.adrshowflag AS adrShowFlag, ";                                                                    
     171               0 :         $select.= "user.mailshowflag AS mailShowFlag, ";                                                                  
     172               0 :         $select.= "user.picshowflag AS picShowFlag, ";                                                                    
     173               0 :         $select.= "user.university AS university, ";                                                                      
     174               0 :         $select.= "user.department AS department, ";                                                                      
     175               0 :         $select.= "user.subject AS subject, ";                                                                            
     176               0 :         $select.= "user.hpcounter AS hpcounter, ";                                                                        
     177               0 :         $select.= "user.context_keywords AS contextKeywords, ";                                                           
     178               0 :         $select.= "user.context_news AS contextNews, ";                                                                   
     179               0 :         $select.= "user.style_overwrite_mode AS styleOverwriteMode, ";                                                    
     180               0 :         $select.= "user.num_failed_logins AS numFailedLogins, ";                                                          
     181               0 :         $select.= "user.num_bans_for_failed_login AS numBansForFailedLogin, ";                                            
     182               0 :         $select.= "user.styletemplate AS styleTemplate ";                                                                 
     183               0 :         $select.= "FROM user ";                                                                                           
     184               0 :         $select.= "WHERE user.ID = ".$this->userid;                                                                       
     185               0 :         return $select;                                                                                                   
     186                 :     }                                                                                                                     
     187                 : }                                                                                                                         
     188                 :                                                                                                                           
     189                 : ?>                                                                                                                        

Generated by PHPUnit 3.2.21 and Xdebug 2.0.3 at Thu Nov 26 17:01:15 CET 2009.